let fs = require('fs')

// 读取文件夹
let files = fs.readdirSync(__dirname)
console.log(files, 1111111)

// 遍历文件
files.forEach(name => {
  console.log( name );

  // 读取文件
  // let file = fs.readFileSync(__dirname + '/' + name)
  // console.log(name, file.toString() );

  // 重命名
  if (name.includes('.txt')) {
    let err = fs.renameSync(__dirname + '/' + name, __dirname + '/0' + name)
    if( !err ) console.log( '重命名成功' );
  }
});
